﻿using System;
using Base.Core.Ex;
using System.Windows.Data;
using System.Globalization;

namespace WpfAi.Convert
{
    public class EnumToDescriptionConvert : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null || !value.GetType().IsEnum)
                return string.Empty;
            return ((System.Enum)value).GetDescription();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
